Summary
Retries help with transient failures. Circuit breakers stop calls to a failing dependency so the system can recover and avoid cascading failure.
Interview Points
- Retry only when the operation is safe or idempotent.
- Use exponential backoff and jitter.
- Circuit breaker states: closed, open, half-open.
- Breakers protect dependencies and caller resources.
- Bad retries can amplify outages.
2-3 Minute Interview Script
“Retries and circuit breakers solve different reliability problems. A retry handles transient failures like a dropped packet or a brief timeout. A circuit breaker handles sustained dependency failure by stopping calls temporarily.
Retrying blindly is dangerous because it can multiply load during an outage. I use bounded retries, exponential backoff, jitter, and only retry operations that are safe or idempotent.
A circuit breaker watches failures. When failures cross a threshold, it opens and fails fast. After a cool-down, it enters half-open and allows a few test requests before closing again.
In an interview, I would say retries improve success rate for small blips, while circuit breakers preserve system stability when the dependency is unhealthy.”
Follow-Ups
- Why add jitter?
- What operations should not be retried?